package com.gameShare.service.user

import com.gameShare.mappers.user.UserInfoMapper
import com.gameShare.utils.DateFormatter
import entity.dto.user.UserCenterUserInfoDto
import org.springframework.stereotype.Service

@Service
class UserCenterService(
    private val userInfoMapper: UserInfoMapper
) {


    fun loadUserInfo(userId: String): UserCenterUserInfoDto {
        val userInfo = userInfoMapper.selectUserCenterUserInfo(userId)
        return UserCenterUserInfoDto(
            userInfo.nickName,
            userInfo.avatar,
            DateFormatter.computeNowBetweenJoinTime(userInfo.jointTime)
        )
    }
}